const mongoose = require('mongoose')

const Schema = mongoose.Schema

mongoose.connect("mongodb://localhost/graproject", { useNewUrlParser: true })

var writingSchema = new Schema({

    blogId:{//博主的id  根据此id获取文章数据
        type: Object,
        required: true
    },

    typeId:{//根据 文章 id查找分类
        type: String,
        required: true
    },

    wTime: {//这是一个时间戳 当天写的文章都保存在当的 wData中
        type: String,
        required: true
    },
      
    wData: {
        type: Array,
        required: true
    },
    /*
        下面的数据应该保存在一个数组里面 
        该数组 里面即为一条条对象 对象应该保存一下数据
        writingId: {//文章id
            type: String,
            required: true
        },
        writingLink: {//文章链接
            type: String,
            required: true
        },
        writingTitle: {//文章标题
            type: String,
            required: true
        },
        writingAbstract: {//文章摘要
            type: String,
            required: true
        },
        writingTime: {//文章时间
            type: String,
            required: true
        },
        writingReaderNum: {//文章阅读数量
            type: Number,
            required: true
        },
        writingLikeNum: {//文章点赞数量
            type: Number,
            required: true
        },
        writingOpposeNum: {//文章反对数量
            type: Number,
            required: true
        }
    */
})

module.exports = mongoose.model('writing', writingSchema)